<div class="crumb-wrap">
    <div class="crumb-list"> <i class="icon-font"></i>
        <a href="<?=site_url()?>">首页</a>
        <span class="crumb-step">&gt;</span>
        <span class="crumb-name">活码管理</span>
    </div>
</div>
<div class="result-wrap">
    <form name="myform" id="myform" method="post">
        <div class="result-title">
            <div class="result-list">
                <a href="<?=site_url('qrset/create')?>"> <i class="icon-font"></i>
                    新增活码
                </a>
            </div>
        </div>
        <div class="result-content">
            <table class="result-tab" width="100%">
                <tr>
                    <th>ID</th>
                    <th>名称</th>
                    <th>跳转链接</th>
                    <th>创建时间</th>
                    <th>访问次数</th>
                    <th>操作</th>
                </tr>

                <?php foreach($list as $k => $v):?>
                <tr>
                    <td><?=$v['id']?></td>
                    <td><?=$v['name']?></td>
                    <td><a href="<?=site_url('qrcode/index?code_id='.$v['code_id'])?>" target="_blank"><?=substr($v['content'],0,40)?> ...</a></td>
                    <td><?=date('Y-m-d H:i:s',$v['create_time'])?></td>
                    <td><?=$v['num']?></td>
                    <td>
                        <a class="link-update" href="javascript:;" onclick="get_qr('<?=base_url('/qr/images/'.$v['code_id'].'.png')?>')">获取二维码</a>
                        <a class="link-update" href="<?=site_url('qrset/update?cid='.$v['id'])?>">修改</a>
                        <a class="link-del" href="javascript:;" onclick="delete_qr(<?=$v['id']?>)">删除</a>
                    </td>
                </tr>
                <?php endforeach;?>
            </table>
            <div class="list-page"><?=$page?></div>
        </div>
    </form>
</div>

<script type="text/javascript">

    /**
     * 项目删除
     */
    function delete_qr(cid){
        layer.confirm('删除之后不可恢复，是否确定？', {
            btn: ['确定','取消'], //按钮
            icon: 0
        }, function(){
            $.post("<?=site_url('qrset/delete')?>",{cid:cid},function(data){
                if(data == 1){
                    layer.alert("操作成功！",{
                        icon:1,
                    },function(){
                        location.reload();
                    });
                }else{
                    layer.alert(data,{
                        icon:2,
                    });
                }
            });
        });
    }

    /**
     * 查看二维码
     */
    function get_qr(url){
        layer.open({
            type: 1,
            title: false,
            closeBtn: false,
            shadeClose: true,
            area: ['492px', '492px'],
            skin: 'yourclass',
            content: "<img style='width:487px;height:487px' src='"+url+"' alt='二维码' title='二维码扫描'/>"
        });

    }
</script>